import axios from 'axios'
import { hostUrl,domain } from '@/assets/public'

const verify = {
    data() {
        return {
            _config      : {},
        }
    },
    methods: {
        $_verifyConfig() {
            let _self = this;
            //alert(domain);
            let url = domain + "unifast/dingtalk/config"
            axios.get(url, { })
            .then(function (data) {
             // alert("开始鉴权");
                if(data.data){
                    _self._config=eval('('+data.data+')');
                     //JSAPI配置
                     dd.config({
                       agentId   : _self._config.agentid,   
                       corpId    : _self._config.corpId,
                       timeStamp : _self._config.timeStamp,
                       nonceStr  : _self._config.nonceStr,
                       signature : _self._config.signature,
                       //需要用到功能列表在此添加
                       jsApiList : [
                           'device.launcher.launchApp',
                           'biz.user.get'
                       ]
                    });
                    dd.ready(function() {
                     //  alert("鉴权成功");
                        /*dd.device.launcher.launchApp({
                            app: 'com.ht.cjloa', //iOS:应用scheme;Android:应用包名
                            activity :'', //仅限Android，打开指定Activity，可不传。如果为空，就打开App的Main入口Activity
                            onSuccess : function(data) {
                                alert(data.result)
                            },
                            onFail : function(err) {
                                // alert(err)
                            }
                        });*/
                    });
                }
            })
            .catch(function (error) { });

           
        },
    }
}
export default verify
